<!DOCTYPE html>
<html lang="en">

<head>
	<meta charset="UTF-8">
	<meta name="viewport" content="width=device-width, initial-scale=1.0">
	<meta http-equiv="X-UA-Compatible" content="ie=edge">
	<title>Document</title>
	<link rel="stylesheet" href="__PUBLIC__/home/assets/css/amazeui.css" />
	<link rel="stylesheet" href="__PUBLIC__/home/assets/css/other.min.css" />
	<link rel="stylesheet" href="__PUBLIC__/home/assets/css/common.min.css" />
	<script src="__PUBLIC__/home/assets/js/jquery-2.1.0.js" charset="utf-8"></script>
</head>

<body class="login-container">
	<div class="login-box">
		<div class="logo-img">
			<img src="__PUBLIC__/home/assets/images/logo2_03.png" alt="" />
		</div>
		<form action="" class="am-form" data-am-validator>
			<div class="am-form-group">
				<label for="username">
					<i class="am-icon-user"></i>
				</label>
				<input type="text" id="username" placeholder="帐号" required/>
			</div>

			<div class="am-form-group">
				<label for="password">
					<i class="am-icon-key"></i>
				</label>
				<input type="password" id="password" placeholder="密码" required/>
			</div>
			<button class="am-btn am-btn-secondary j-login" type="button">登录</button>
		</form>
	</div>

	<script type="text/javascript">
		// 提交按钮
		$('.j-login').on('click', function () {

			Login();

		});

		// 提交按钮
		$('#password').on('keydown', function (e) {

			if (e.keyCode == 13) { Login(); }

		});

		function Login() {

			if (!$('#username').val()) { alert('请输入帐号！'); return }

			if (!$('#password').val()) { alert('请输入密码！'); return }

			var param = {

				username: $('#username').val(),

				password: $('#password').val()

			}

			$.ajax({

				url: "login",

				data: param,

				type: 'post',

				success: function (res) {

					if (res.status == 1) {

						window.location.href = '/Admin//Index/index';

					} else {

						alert(res.data)

					}

				}

			});

		}

	</script>
</body>

</html>